<?php


class Url extends ExportConverter {
  
  public function Export(){
    if (is_null($this->value))
      return '';
    if ( is_string($this->value) )
      return urlencode( $this->value );
    if ( is_bool($this->value) )
      return $this->value ? 'true' : 'false';
    if ( is_int($this->value) )
      return sprintf('%d',$this->value);
    if ( is_float($this->value) )
      return sprintf('%F',$this->value);
    if ( $this->value instanceof GenericID )
      return $this->value->Encode();
    if ( $this->value instanceof ID )
      return $this->value->AsHex();
    if ( $this->value instanceof ImmutableTimeSpan )
      return strval($this->value->GetTotalSeconds());
    if ( $this->value instanceof ImmutableDateTime )
      return $this->value->Format('YmdHis');
    if ( $this->value instanceof DateTime )
      return $this->value->format('YmdHis');
    if ( $this->value instanceof DBItem )
      return $this->value->id->AsHex();
    if ( is_array($this->value) || $this->value instanceof IteratorAggregate ){
    	$a = array();
    	foreach ($this->value as $x)
    		$a[] = strval(new Url($x));
    	return implode($a,',');
		}
    return urlencode( strval($this->value) );
  } 
  
  


}


  
?>
